/**
 * Copyright(c) 2006-2008, FeyaSoft Inc.
 * ====================================================================
 * Licence
 * ====================================================================
 * FeyaSoft is free software distributed under the GNU GPL version 2 or higher, 
 * GNU LGPL version 2.1 or higher as published by the Free Software Foundation. 
 */
package("feyaSoft.util");

/**
 * This JS is mainly used to handle util function for ext
 *
 * @author fzhuang
 * @Date July 26, 2007
 */
feyaSoft.util.extUtil = feyaSoft.util.extUtil || {

	/**
	 * create a dialog based on the enter name
	 *
     * @method createNewDialog
     * @param dialogName
     * @return dialog
     */  
	 createDialog: function(dialogName, wide, high) {
	     var thisDialog = new Ext.LayoutDialog(dialogName, {
	             modal:true,
	             autoTabs:true,
	             proxyDrag:true,
	             resizable:false,
	             width: wide,
	             height: high,
	             shadow:true,
		         center: {
	                 autoScroll: true,
	                 tabPosition: 'top',
	                 closeOnTab: true,
	                 alwaysShowTabs: false
	             }
	     });
	     thisDialog.addKeyListener(27, thisDialog.hide, thisDialog); 
	     thisDialog.addButton('Cancel', function() {thisDialog.hide();});
	     
	     thisDialog.endUpdate();    
	     return thisDialog;
	},
	
	/**
	 * create a dialog based on the enter name
	 *
     * @method createNewDialog
     * @param dialogName
     * @return dialog
     */  
	 viewDialog: function(dialogName, wide, high) {
	     var thisDialog = new Ext.LayoutDialog(dialogName, {
	             modal:true,
	             autoTabs:true,
	             proxyDrag:true,
	             resizable:false,
	             width: wide,
	             height: high,
	             shadow:true,
		         center: {
	                 autoScroll: true,
	                 tabPosition: 'top',
	                 closeOnTab: true,
	                 alwaysShowTabs: false
	             }
	     });
	     thisDialog.addKeyListener(27, thisDialog.hide, thisDialog); 
	     thisDialog.addButton('Close', function() {thisDialog.hide();});
	     
	     thisDialog.endUpdate();    
	     return thisDialog;
	}

};